#include "path.h"

#include <QDir>

Path::Path()
{ }

Path::Path(const QString& path)
    : path_(path)
{ }

QString Path::posixStyle() const
{
    QString result;
    std::unique_copy(path_.begin(), path_.end(), std::back_inserter(result), [](QChar c1, QChar c2) {
        return ((c1 == '/' || c1 == '\\')) && (c2 == '/' || c2 == '\\');
    });
    result.replace('\\', '/');
    return result;
}

QString Path::windowsStyle() const
{
    QString result = this->posixStyle();
    result.replace("/", "\\\\");
    return result;
}
